package com.htc.controller;

import com.htc.common.ActionEvent;
import com.htc.constants.Constants;
import com.htc.dlc.fragment.FragmentHome;
import com.htc.dlc.fragment.FragmentNews;
import com.htc.model.utils.NewsModel;

public class NewsModelController {
	public static NewsModelController instance;

	public static NewsModelController getInstance() {
		if (instance == null)
			instance = new NewsModelController();
		return instance;
	}

	public void handleViewEvent(ActionEvent e) {
		switch (e.action) {
		case Constants.GET_NEWS_MODEL:
			NewsModel.getInstance().handleControllerEvent(e);
			break;

		case Constants.GET_NEWS_MODEL1:
			NewsModel.getInstance().handleControllerEvent(e);
			break;

		default:
			break;
		}
	}

	public void handleModelViewEvent(ActionEvent e) {
		switch (e.action) {
		case Constants.GET_NEWS_MODEL:
			FragmentHome sender = (FragmentHome) e.sender;
			sender.handleControllerViewEvent(e);
			break;
		case Constants.GET_NEWS_MODEL1:
			FragmentNews sender1 = (FragmentNews) e.sender;
			sender1.handleControllerViewEvent(e);
			break;

		default:
			break;
		}
	}
}
